lundi 4 janvier 2016

How to use SecureRandom.urlsafe_base64?

I'm really new to this and need to create an url-safe token of between 2 and 20 characters and only alphanumeric chars (letters and numbers) are allowed. I use this token for processing by a payment provider.

I have the method below, but I got an error that the token was invalid. How can I rewrite the method so that it's still url-safe but does not exceed 20 characters and only uses alphanumeric chars?

token = SecureRandom.urlsafe_base64




Aucun commentaire:

Enregistrer un commentaire