Forum Libraries, Components, and Plugins

Using Xamarin.Auth for OAuth2 authentication - username and password

I'm facing some issue, while using Xamarin.Auth for OAuth2 authentication.
From POSTMAN I'm sending request for token, via GET method to my backend URL: by adding to header:
Authorization, Basic xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

and with below parameters in URL:

so it goes like:
it gives me back JSON, which looks like:

"access_token": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"token_type": "bearer",
"refresh_token": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"expires_in": 9999,
"scope": "read"

I wanted to authenticate to my backend service, from mobile application (using Xamarin.Forms app), and I've tried to use Xamarin.Auth, for authenticating to my back-end -

Indeed using OAuth2Authenticator, it's able at least to "ping" my backend (by putting URL, clientIde etc), as it returns:

Full authentication is required to access this resource

however message it's beeing send in wrong way - at least I think so, as there is no Authorization in header + I haven't see any possibility to pass username and password into OAuth2Authenticator.

Does anyone have idea, how I can do this? Or should I use something else - not Xamarin.Auth?



  • VegasJVegasJ USUniversity ✭✭
    edited February 2017

    I know this is old but for others looking, I don't think Xamarin.Auth OAuth2Authenticator supports the password grant_type, only the implicit and auth code ones. I believe you would need to extend and write a custom OAuth2Authenticator.

Sign In or Register to comment.