Home > database >  get token from API Login Response and pass to API header request Header of other Menu in Xamarin For
get token from API Login Response and pass to API header request Header of other Menu in Xamarin For

Time:11-29

I'm new to Xamarin Forms iOS and I want to get token value after Login.

I have read documentation: Get Procurement List

I want to get previous User Login response token and make it authorization header in GET Procurement List. Kindly help to enlighten what is missing/wrong.

CodePudding user response:

Please use Xamarin.Essentials to save Token value on login success response. Please get its value like below, when ever you need it to pass in header.

The Preferences class helps to store application preferences in a key/value store.

To save a value:

Preferences.Set("my_key", "my_value");

To get a value:

var myValue = Preferences.Get("my_key", "default_value");

Refer to know more about preferences: https://learn.microsoft.com/en-us/xamarin/essentials/preferences?tabs=android

Hope this helps.!

  • Related