Police were called to a report of suspicious activity, and found Jevgenij Cerepanin with a small amount of the drug, on February 11.
His real identity was quickly determined after he lied to officers, said prosecutor Donna Fawcett, but he failed to turn up to court on May 3.
Two days before the court appearance, he was recorded on CCTV stealing two electric toothbrushes from TK Maxx.
"He said he stole them for food as he was hungry, but also accepted he had a heroin addiction," said Ms Fawcett.
She said Cerepanin takes one to two doses of heroin daily, and tested positive for opiates at the station.
Rebecca Williams, mitigating, said it was a small amount of amphetamine, and the lies he told at the station were "quickly remedied."
She said his relationship had broken down and he is now street homeless. She said he had turned to drugs after the deaths of his parents a year ago.
Probation officer Cheryl Nisbet says he gave a false name because he feared he would be deported.
She said he stole the toothbrushes for £10 and he used the money to buy food, but he also tested positive for heroin.
Cerepanin is now living in a tent at the back of Sainsbury's and surviving on cash in hand jobs, she said.
"He has been a heroin user for 15 years, with periods of abstinence, when things aren't going well, he will relapse," she said.
Because of poor engagement in the past he would not be offered a drug rehabilitation programme, Mrs Nisbet said, adding that he would prefer to deal with the addiction himself.
Cerepanin, 35, formerly of Westbourne Close, Mansfield Woodhouse, admitted possession of the drug, obstructing a police constable, and theft, via a Russian translator, when he appeared at Mansfield Magistrates Court, on Wednesday.
The court heard he owes £1,176 in unpaid fines. A fine of £660 for driving with no insurance was reduced to £180.
He was given a 12 month community order, with 15 activity requirement days in the hope it will motivate him to get help for his drug use, accommodation and benefits.
He was ordered to pay £85 costs and an £85 government surcharge, at a rate of £10 per fortnight.