xamarin / Xamarin.Auth

Xamarin.Auth
Apache License 2.0
541 stars 351 forks source link

OAuth2.0 integration with Xamarin #374

Open thiruvenkadame opened 5 years ago

thiruvenkadame commented 5 years ago

OAuth2.0 integration with Xamarin

  1. We build our own "OWIN OAuth 2.0 Authorization Server" using "Microsoft.AspNet.Identity.Owin" and "Microsoft.Owin" framework. Ref: https://docs.microsoft.com/en-us/aspnet/aspnet/overview/owin-and-katana/owin-oauth-20-authorization-server

  2. We can be able to send a request to our custom OAuth2.0 server and get OAuth2.0 access token from web applications by using "DotNetOpenAuth.OAuth2.Client".

  3. Also, we can be able to successfully integrate our custom OAuth2.0 server with Cortana bot channel and its working fine.

  4. But while integrating our custom OAuth2.0 server with Xamarin mobile application we are facing issues related to redirect_uri. We get a response like invalid_grant.

  5. We are using "Xamarin.Auth" framework in Xamarin to send the OAuth request.

  6. Here is the redirect_uri, we used in Web and Mobile a. Xamarin app redirect_uri: com.Demo.Mobile:/oauth2redirect b. Web site redirect_uri: https://demowebsite.azurewebsites.net/ https://user-images.githubusercontent.com/5037741/54964768-10d0ca80-4f44-11e9-9fd9-92673f07f919.png

Thanks in advance for help on this :)

thiruvenkadame commented 5 years ago

We resolved the issue by using this redirect_uri pattern oauth2redirect:/com.company.package/

mcfoi commented 4 years ago

We resolved the issue by using this redirect_uri pattern oauth2redirect:/com.company.package/

Reversing the redirect_uri gives me "Invalid parameter value for redirect_uri: Missing authority; oauth2redirect:com.companyname.myapp

How did you solve?