I've created an application using the Enterprise Auth template. Now I can log to my Azure AD B2C in my application. It's working fine.
The part I struggle with is to use the info I have when I call _userService.getActiveUser() and to use it to call my existing Azure Web App REST API.
I've tried a lot of things, like using the authToken property, the access_token, id_token, but nothing is working...
Any help would be greatly appreciated! :)
Yes, I'm trying to use my user's credential to authenticate to a REST API that is hosted as a Azure Web App. So I have my api's address (ex: https://app.mysite.com/api/) and multiple services are hosted there.
I understand I could wrap my api with a RAPID REST Service and it should automatically authenticate by passing my token automatically, correct?
Is there some documentation about how to do it exactly? Which endpoint the mobile application should be calling? Do I need to define service objects?
I'd like to keep it as simple as possible.
How are you trying to connect to a REST service? The general way of doing so is to create a RAPID REST service in the Kinvey console, and then use the SDK to connect to it. If you set the authentication type to OAuth in the RAPID REST configuration, the token will be automatically passed.
I've looked at some documentation from Microsoft:
From what I see there, I should add a header to my request to my REST API:
GET /data HTTP/1.1
Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsIng1dCI6Ik5HVEZ2ZEstZnl0aEV1THdqcHdBSk9NOW4tQSJ9.eyJhdWQiOiJ...
I tried to use the access_token (which I think should be the rigth one) and the authToken values, but both aren't working. Where should I find the Bearer token for my authenticated user?