# man > Net::Twitter::OAuth(3pm)

---
type: CommandReference
command: Net::Twitter::OAuth
mode: perldoc
section: 3pm
source: perldoc
---

## Quick Reference

- `Net::Twitter::OAuth->new(consumer_key => $key, consumer_secret => $secret)` — deprecated wrapper; use `Net::Twitter->new(traits => [qw/Legacy OAuth/])` instead
- `Net::Twitter->new(traits => [qw/API::RESTv1_1 OAuth/])` — recommended modern usage for REST API with OAuth

## Name

Net::Twitter::OAuth — Net::Twitter with 'Legacy' and 'OAuth' roles for backwards compatibility

## Synopsis

perl
use Net::Twitter;

# Deprecated:
my $nt = Net::Twitter::OAuth->new(consumer_key => $key, consumer_secret => $secret);

# Recommended:
$nt = Net::Twitter->new(traits => [qw/API::RESTv1_1 OAuth/]);
$nt = Net::Twitter->new(traits => [qw/Legacy OAuth/]);  # for legacy idioms
## Options

No options are documented specifically for Net::Twitter::OAuth. See [Net::Twitter](http://localhost/phpMan.php/perldoc/Net%3A%3ATwitter/markdown) for `new` options.

## Examples

**Deprecated usage (backwards compatibility):**

perl
use Net::Twitter;
my $nt = Net::Twitter::OAuth->new(consumer_key => $key, consumer_secret => $secret);
**Modern usage with OAuth and REST API:**

perl
use Net::Twitter;
$nt = Net::Twitter->new(traits => [qw/API::RESTv1_1 OAuth/]);
**Legacy idiom compatibility:**

perl
$nt = Net::Twitter->new(traits => [qw/Legacy OAuth/]);
## See Also

- [Net::Twitter](http://localhost/phpMan.php/perldoc/Net%3A%3ATwitter/markdown)
- [Net::Twitter::Role::OAuth](http://localhost/phpMan.php/perldoc/Net%3A%3ATwitter%3A%3ARole%3A%3AOAuth/markdown)